package com.cskaoyan.gateway.controller.shopping;

import com.mall.commons.result.ResponseData;
import com.mall.commons.result.ResponseUtil;
import com.mall.shopping.IContentService;
import com.mall.shopping.dto.NavListResponse;
import com.mall.user.annotation.Anoymous;
import com.mall.user.constants.SysRetCodeConstants;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 创建日期: 2022-01-20-13-48
 * author : XGQ
 * description: 导航栏显示
 */
@RestController
@RequestMapping("shopping")
public class NavigationController {

    @Reference(timeout = 10000,retries = 0,check = false)
    IContentService contentService;

    @GetMapping("navigation")
    @Anoymous
    public ResponseData getShowNavigation(){
        NavListResponse response = contentService.queryNavList();
        if (response.getCode().equals(SysRetCodeConstants.SUCCESS.getCode())) {
            return new ResponseUtil().setData(response.getPannelContentDtos());
        }
        return new ResponseUtil().setErrorMsg(response.getMsg());
    }
}
